﻿/*
 * zhoujiliang02 创建于 2021/8/17 10:01:01
 */

using System;
using System.Collections.Generic;
using System.Linq;
using VisionCloud.Core.Model.Ms;
using VisionCloud.Domain.Repository.Interface.Ms;

namespace VisionCloud.Domain.Repository.Implement.Ms
{
    public class MsProjectEditLogRepository : BaseRepository<MsProjectEditLog>, IMsProjectEditLogRepository
    {
        public Dictionary<Guid, int> HasChangeLog(List<Guid> projectIds)
        {
            return Db.MsProjectEditLogs.Where(x => projectIds.Contains(x.ProjectId) && x.IsPublished)
                .GroupBy(x => x.ProjectId)
                .Select(x => new { ProjectId = x.Key, Count = x.Count() })
                .ToDictionary(x => x.ProjectId, x => x.Count);
        }
    }
}